home *** CD-ROM | disk | FTP | other *** search
- Path: news.bs.tpl.net!news
- From: Dieter Lⁿcking <luecking@braunschweig.netsurf.de>
- Newsgroups: comp.lang.c++
- Subject: Re: Copy constructor
- Date: Sat, 13 Apr 1996 00:59:42 +0200
- Organization: IRD InterNet Services GmbH
- Message-ID: <316EE05E.72F7@braunschweig.netsurf.de>
- References: <4kjudi$2qj0@holly.ACNS.ColoState.EDU>
- NNTP-Posting-Host: plueckin.braunschweig.netsurf.de
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.01 (Win95; I)
-
- Corby S. Hudnall wrote:
- >
- > Hi all, I'm having some trouble figuring out how to do a copy
- > constructor. Here's what I thought was suppose to work:
- >
- > header file----
- > class ABC
- > {
- > private:
- > int AnInt;
- >
- > public:
- > ABC():AnInt(5) {} // Default Constructor
- > ~ABC() {} // Default Destructor
- > ABC(const ABC&); // Copy constructor
- > }
-
- MISSING: ;
-
- >
- > ABC::ABC(const ABC& NewABC)
- > {
- > this->AnInt = NewABC->AnInt;
- > }
- >
- > Unfortunatly, I can't get this to work right. I get weird messages from
- > the compiler complaining about not being able to use a class definition
- > as an argument. This was using xlC under IBM Aix. Any suggestions are
- > greatly appreciated. Thanks.
-
- Are any ugly defines invoked ?
-
- Bye
- Dieter
-
-